var vue = new Vue({
	el: "body",
	data: {
		username: "",
		isloading: true,
		load: false,
		info: {},
		sex: false,
	},
	created: function() {
		var token = sessionStorage.getItem("token");
		var appid = sessionStorage.getItem("appid");
		this.username = sessionStorage.getItem("username");
		if (this.username != null) {
			this.load = true;
			this.getNickname(appid, token);
		}
	},
	methods: {
		getNickname: function(appid, token) {
			$.ajax({
				type: 'get',
				url: "http://v2.mashupcloud.cn/SQL/select_userinfo/",
				async: true,
				data: {
					appid: appid,
					token: token,
					name: 'select_userinfo',
					_v1: this.username
				},
				success: function(json) {
					vue.info = JSON.parse(json)[2][0];
				},
				error: function(json) {
					console.log("err:" + json);
				}
			});
		},
		setinfo: function() {
			var token = sessionStorage.getItem("token");
			var appid = sessionStorage.getItem("appid");
			$.ajax({
				type: 'get',
				url: "http://v2.mashupcloud.cn/SQL/myupdatainfo/",
				async: true,
				data: {
					appid: appid,
					token: token,
					name: 'myupdatainfo',
					_v1: vue.info.nickname,
					_v2: vue.info.name,
					_v3: vue.info.sex,
					_v4: vue.info.one,
					_v5: vue.info.phone,
					_v6: vue.info.introduction,
					_v7: vue.info.username
				},
				success: function(json) {
					console.log("json==" + json);
					history.back();
				},
				error: function(json) {
					console.log("err:" + json);
				}
			});
		},
		cancel: function() {
			history.back();
		},
		setsex: function(t) {
			if (t) {
				vue.sex = "女";
			} else {
				vue.sex = "男";
			}
			console.log(vue.sex)
		}
	}
});